home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Source / GNU / libg++ / libio / stdio / stdio.h < prev    next >
C/C++ Source or Header  |  1994-02-15  |  5KB  |  155 lines

  1. /* This is part of the iostream/stdio library, providing -*- C -*- I/O.
  2.    Define ANSI C stdio on top of C++ iostreams.
  3.    Copyright (C) 1991 Per Bothner.
  4.  
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Library General Public
  7. License as published by the Free Software Foundation; either
  8. version 2 of the License, or (at your option) any later version.
  9.  
  10.  
  11. This library is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. Library General Public License for more details.
  15.  
  16. You should have received a copy of the GNU Library General Public
  17. License along with this library; if not, write to the Free
  18. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20. #ifndef _STDIO_H
  21. #define _STDIO_H
  22. #define _STDIO_USES_IOSTREAM
  23.  
  24. #include <libio.h>
  25.  
  26. #ifndef NULL
  27. #ifdef __cplusplus
  28. #define NULL 0
  29. #else
  30. #define NULL (void*)0
  31. #endif
  32. #endif
  33.  
  34. #ifndef EOF
  35. #define EOF (-1)
  36. #endif
  37. #ifndef BUFSIZ
  38. #define BUFSIZ 1024
  39. #endif
  40.  
  41. #define _IOFBF 0 /* Fully buffered. */
  42. #define _IOLBF 1 /* Line buffered. */
  43. #define _IONBF 2 /* No buffering. */
  44.  
  45. #define SEEK_SET 0
  46. #define SEEK_CUR 1
  47. #define SEEK_END 2
  48.  
  49.  /* define size_t.  Crud in case <sys/types.h> has defined it. */
  50. #if !defined(_SIZE_T) && !defined(_T_SIZE_) && !defined(_T_SIZE)
  51. #if !defined(__SIZE_T) && !defined(_SIZE_T_) && !defined(___int_size_t_h)
  52. #if !defined(_GCC_SIZE_T) && !defined(_SIZET_)
  53. #define _SIZE_T
  54. #define _T_SIZE_
  55. #define _T_SIZE
  56. #define __SIZE_T
  57. #define _SIZE_T_
  58. #define ___int_size_t_h
  59. #define _GCC_SIZE_T
  60. #define _SIZET_
  61. typedef _IO_size_t size_t;
  62. #endif
  63. #endif
  64. #endif
  65.  
  66. typedef struct _IO_FILE FILE;
  67. typedef _IO_fpos_t fpos_t;
  68.  
  69. #define FOPEN_MAX     _G_FOPEN_MAX
  70. #define FILENAME_MAX _G_FILENAME_MAX
  71. #define TMP_MAX 999 /* Only limited by filename length */
  72.  
  73. #define L_ctermid     9
  74. #define L_cuserid     9
  75. #define P_tmpdir      "/tmp"
  76. #define L_tmpnam      20
  77.  
  78. /* For use by debuggers. These are linked in if printf or fprintf are used. */
  79. extern FILE *stdin, *stdout, *stderr; /* TODO */
  80.  
  81. #define stdin _IO_stdin
  82. #define stdout _IO_stdout
  83. #define stderr _IO_stderr
  84.  
  85. #define getc(fp) _IO_getc(fp)
  86. #define putc(c, fp) _IO_putc(c, fp)
  87. #define putchar(c) putc(c, stdout)
  88. #define getchar() getc(stdin)
  89.  
  90. #ifdef __cplusplus
  91. extern "C" {
  92. #endif
  93.  
  94. #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
  95. #define _ARGS(args) args
  96. #else
  97. #define _ARGS(args) ()
  98. #endif
  99.  
  100. extern void clearerr _ARGS((FILE*));
  101. extern int fclose _ARGS((FILE*));
  102. extern int feof _ARGS((FILE*));
  103. extern int ferror _ARGS((FILE*));
  104. extern int fflush _ARGS((FILE*));
  105. extern int fgetc _ARGS((FILE *));
  106. extern int fgetpos _ARGS((FILE* fp, fpos_t *pos));
  107. extern char* fgets _ARGS((char*, int, FILE*));
  108. extern FILE* fopen _ARGS((const char*, const char*));
  109. extern int fprintf _ARGS((FILE*, const char* format, ...));
  110. extern int fputc _ARGS((int, FILE*));
  111. extern int fputs _ARGS((const char *str, FILE *fp));
  112. extern size_t fread _ARGS((void*, size_t, size_t, FILE*));
  113. extern FILE* freopen _ARGS((const char*, const char*, FILE*));
  114. extern int fscanf _ARGS((FILE *fp, const char* format, ...));
  115. extern int fseek _ARGS((FILE* fp, long int offset, int whence));
  116. extern int fsetpos _ARGS((FILE* fp, const fpos_t *pos));
  117. extern long int ftell _ARGS((FILE* fp));
  118. extern size_t fwrite _ARGS((const void*, size_t, size_t, FILE*));
  119. extern char* gets _ARGS((char*));
  120. extern void perror _ARGS((const char *));
  121. extern int printf _ARGS((const char* format, ...));
  122. extern int puts _ARGS((const char *str));
  123. extern int remove _ARGS((const char*));
  124. extern int rename _ARGS((const char* _old, const char* _new));
  125. extern void rewind _ARGS((FILE*));
  126. extern int scanf _ARGS((const char* format, ...));
  127. extern void setbuf _ARGS((FILE*, char*));
  128. extern void setlinebuf _ARGS((FILE*));
  129. extern void setbuffer _ARGS((FILE*, char*, int));
  130. extern int setvbuf _ARGS((FILE*, char*, int mode, size_t size));
  131. extern int sprintf _ARGS((char*, const char* format, ...));
  132. extern int sscanf _ARGS((const char* string, const char* format, ...));
  133. extern FILE* tmpfile _ARGS((void));
  134. extern char* tmpnam _ARGS((char*));
  135. extern int ungetc _ARGS((int c, FILE* fp));
  136. extern int vfprintf _ARGS((FILE *fp, char const *fmt0, _G_va_list));
  137. extern int vprintf _ARGS((char const *fmt, _G_va_list));
  138. extern int vsprintf _ARGS((char* string, const char* format, _G_va_list));
  139.  
  140. #if !defined(__STRICT_ANSI__) || defined(_POSIX_SOURCE)
  141. extern FILE *fdopen _ARGS((int, const char *));
  142. extern int fileno _ARGS((FILE*));
  143. extern FILE* popen _ARGS((const char*, const char*));
  144. extern int pclose _ARGS((FILE*));
  145. #endif
  146.  
  147. extern int __underflow _ARGS((struct _IO_FILE*));
  148. extern int __overflow _ARGS((struct _IO_FILE*, int));
  149.  
  150. #ifdef __cplusplus
  151. }
  152. #endif
  153.  
  154. #endif /*!_STDIO_H*/
  155.